# Maintainer (Arch): Sven-Hendrik Haase <svenstaro@gmail.com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Dan Serban
# Contributor: Richard Murri
# Maintainer: Sagar Acharya <sagar@hyperbola.info>

pkgname=python-werkzeug
pkgver=1.0.1
pkgrel=1
pkgdesc='Swiss Army knife of Python web development'
url='https://werkzeug.palletsprojects.com/en/1.0.x/'
arch=('any')
license=('Modified-BSD')
depends=('python')
makedepends=('python-setuptools' 'quilt')
#checkdepends=('python-pytest-timeout' 'python-requests' 'python-pytest-xprocess')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pallets/werkzeug/archive/${pkgver}.tar.gz"
		"series"
		"disable-sphinxcontrib-log_cabinet.patch"
		"drop_ubuntu_font.patch")
sha512sums=('ba82120fb3e96e3a1334c6452d5ba1950fc016d2d147d643bbc2168ccec496f1dea799982ae8c578167155082c0bdbda5d56a23f64b4b6865f97e90e22df022e'
			'37f5d5c868c7de56237986386c70e38dbc202909a64c8235fc75b577d962c2d4dacc39438adcd192eab879dcb33434988a1a5b0057b204f81edd9c56dc5ebf1d'
			'43ca2214e643071c766e59ac7a70241046a8bddd320d7e4361a03e3bda2300b7be178500fe1e4f24108071d12b6ef3491f1c61f467abbac4d7c978b23fdb6fdc'
			'e9fa103c99d89100d8c94c35c337aab9e13c5aa26b7b68767f1803b64470b54c1bc505dfd4098ab081d6a31121447390f881fb179bdc7e8dff658eb292ce51fb')

prepare() {
	cd "werkzeug-$pkgver"
	
	mkdir ./patches
  	cp ${srcdir}/series ./patches
  	cp ${srcdir}/*.patch ./patches

  	export QUILT_PATCHES=patches
  	export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
  	export QUILT_DIFF_ARGS='--no-timestamps'

  	quilt push -av
}

build() {
  cd "werkzeug-$pkgver"

  python setup.py build
}

# check() {
#   cd "werkzeug-$pkgver"
#   PYTHONPATH="$PWD/build/lib" pytest
# }

package() {
  cd "werkzeug-$pkgver"

  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE.rst "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
